<template>
  <div id="" class="changeName">
    <h2 v-title="'昵称'"></h2>
    <h2>修改昵称</h2>
    <div class="inputDiv">
      <p>昵称</p>
      <input type="text" name="" v-model="newName" placeholder="输入新昵称">
    </div>
    <div class="fixedBottom">
      <button type="button" name="button" class="blockBtn" @click="changeName">保存</button>
    </div>
  </div>
</template>
<script>
import {reLoginWX} from '@/util/util.js';
export default {
  name: "",
  data: () => ({
    newName:'',
  }),
  methods: {
    changeName() {
      let that = this;
      let nameParam = {
        userName:that.newName
      }
      network.post(configUrl.EDITUSER_URL,nameParam,function(res){
        console.log(res);
        if(res.code==401) {
          reLoginWX();
        }else{
          that.$router.go(-1);
        }
      },function(err){
        console.log(err);
      })

      // this.$emit('cname',this.newName);
    }
  }
}
</script>
<style lang="scss" scoped src="./memberSetFile.scss"></style>
